package com.yq.interview.enums;

/**
 * @ClassName CountryEnum
 * @Description  枚举的应用
 * 枚举可以当数据库来使用,性能会很优
 * @Author yaoqiang
 * @Date 2020/11/19 15:40
 * @Version 1.0
 */
public enum CountryEnum {
    ONE(1,"齐"),TWO(2,"楚"),THREE(3,"燕"),FOUR(4,"韩"),FIVE(5,"赵"),SIX(6,"魏");

    private Integer retCode;
    private String retMessage;

    public Integer getRetCode() {
        return retCode;
    }

    public String getRetMessage() {
        return retMessage;
    }

    CountryEnum(Integer retCode, String retMessage) {
        this.retCode = retCode;
        this.retMessage = retMessage;
    }

    public static CountryEnum forEach_CountryEnum(int index){
        CountryEnum[] countryEnums= CountryEnum.values();
        for (CountryEnum element:countryEnums
             ) {
            if (index==element.getRetCode()){
                return element;
            }

        }
        return null;
    }

}
